package cl.interpreter;

public class StackAddress extends Variable {
    
    public StackAddress(String name, Object value) throws UnknownTypeException, IncorrectTypeException {
        super(name, value, "pointer");
    }
    
    public String toString() {
        if(getValue() == null) {
            return getName() + " ???";
        } else {
            return getName() + " " + Util.toAddress((Integer)getValue());
        }
    }
    
    protected void validateType(Object value, String type) throws IncorrectTypeException { }
    
    protected int calculateSize(String type) throws UnknownTypeException {
        return 4;
    }
}
